package com.woniuxy.producerconsumer.service.impl;

import com.woniuxy.po.Mail;
import com.woniuxy.producerconsumer.service.PCService;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author: 马宇航
 * @Description: TODO
 * @DateTime: 22/12/29/0029 15:03
 * @Component: 成都蜗牛学苑
 **/
@Service
public class PCServiceImpl implements PCService {
    @Autowired
    RabbitTemplate rabbitTemplate;
    @Override
    public void sendMail(String pcQueue, Mail mail) {
        //设置队列名称 可以不写
        rabbitTemplate.setDefaultReceiveQueue("PCQueue");
        //发送消息到空串交换机，和PCQueue的队列上
        rabbitTemplate.convertAndSend("","PCQueue",mail);
    }
}
